-
Notifications
You must be signed in to change notification settings - Fork 72
Fixup #2196 #2221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fixup #2196 #2221
Conversation
|
Yay, this is breaking now. It requires signatures |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2221 +/- ##
==========================================
- Coverage 88.00% 87.99% -0.01%
==========================================
Files 127 127
Lines 31803 31807 +4
==========================================
+ Hits 27989 27990 +1
- Misses 3814 3817 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I would vote for the temporary fallback, but don't have a strong opinion. |
Use `@inferred` correctly and fix return type
2409e84 to
0a94404
Compare
0a94404 to
a445ea3
Compare
a445ea3 to
6a4051d
Compare
|
I added a fallback, so this should not break anything anymore. Please review and merge :) |
| function exponent_vector(::Type{Vector{S}}, a::MPoly{T}, i::Int) where {T <: RingElement, S} | ||
| e = Vector{S}(undef, nvars(parent(a))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit unusual. I'd expect this to be either
| function exponent_vector(::Type{Vector{S}}, a::MPoly{T}, i::Int) where {T <: RingElement, S} | |
| e = Vector{S}(undef, nvars(parent(a))) | |
| function exponent_vector(::Type{S}, a::MPoly{T}, i::Int) where {T <: RingElement, S} | |
| e = S(undef, nvars(parent(a))) |
(one could also restrict S to e.g. S <: Vector or S <: AbstractVetor)
Or else
| function exponent_vector(::Type{Vector{S}}, a::MPoly{T}, i::Int) where {T <: RingElement, S} | |
| e = Vector{S}(undef, nvars(parent(a))) | |
| function exponent_vector(::Type{S}, a::MPoly{T}, i::Int) where {T <: RingElement, S} | |
| e = Vector{S}(undef, nvars(parent(a))) |
(and then change the callers to pass in just Int resp. eltype(someVectorType)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally did not implement the second option because there is/was this idea floating around that one should also be able to get the exponent vectors as ZZMatrix. Then I would find it inconsistent if there are exponent_vector(ZZRingElem, ...), which gives a Vector, and exponent_vector(ZZMatrix, ...).
I can implement the first variant. I might have preferred my version because it is easier to get the integer type that way, but I don't remember.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm wondering, is there a functional difference between ::Type{Vector{S}} where S and ::Type{S} where S <: Vector? As in, does one type get accepted by one but not the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the same.
julia> f(::Type{Vector{S}}) where {S} = S
f (generic function with 1 method)
julia> g(::Type{S}) where {S <: Vector} = S
g (generic function with 1 method)
julia> f(Vector)
ERROR: MethodError: no method matching f(::Type{Vector})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. That sounds to me like an argument not to change anything here?
I realized that I used
@inferredwrong in the tests for #2196. Because of this, the tests didn't notice thatexponent_vectors(Vector{UInt}, f)did not returnVector{UInt}s.